<!-- 研学管理-研学规划-安全须知 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>
          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="学校名称">
              <el-select v-model="fgrandname" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <template v-if="showAll">

            <el-col :span="6">
            <el-form-item label="课程名称">
              <el-select v-model="fclassname" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="状态">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </template>

          <el-col :span="8">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" @click="getlist">查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <!-- <el-button type="warning" icon="el-icon-upload2">导入</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
                收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FBILLNO" label="设定单号"></el-table-column>
          <el-table-column prop="FSRCNO" label="研学单号"></el-table-column>
          <el-table-column prop="FBILLCREDATE" label="课程日期" width="105"></el-table-column>
          <el-table-column prop="FHOME" label="学校名称" ></el-table-column>
          <el-table-column prop="FCATNAME" label="课程名称" ></el-table-column>
          <el-table-column prop="FFILENAME" label="文件名称"></el-table-column>
          <!-- <el-table-column prop="FMEMO" label="文件说明" ></el-table-column> -->
          <!-- <el-table-column prop="FBILLSTATE" label="状态" width="95"></el-table-column> -->
          <el-table-column fixed="left" label="操作" width="180">
            <template slot-scope="scope">
              <el-button @click.native.prevent="view(scope.row.FCATNO)" icon="el-icon-view" type="text" size="small">
                查看
              </el-button>
              <el-button @click.native.prevent="insert(scope.row.FCATNO)" icon="el-icon-edit" type="text" size="small">
                编辑
              </el-button>
              <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" />
        <Form ref="Form" :parelist="list" />
      </div>
    </div>
  </div>
</template>

<script>
  import jnpf from "@/utils/jnpf"
  import Form from "./Form.vue"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll:false,
        fgrandname:"闵行春申小学",
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],

        //所属教学楼选择数据
        options1: [{
          value: '20E01',
          label: '闵行春申小学'
        }, {
          value: '20E02',
          label: '闵行莘城中学'
        }, {
          value: '20N01',
          label: '闵行莘松中学'
        }, {
          value: '20N02',
          label: '闵行莘庄中学'
        }],
        
        fvisiblelist: [
          { id: "1", fullName: "是" },
          { id: "2", fullName: "否" },
        ],
        total: 0,
        list: [
            {
            "FBILLNO": "K241130001", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME":"上海博物馆研学",
            "FHOME": "闵行春申小学",
            "FFILENAME": "关于学生受伤紧急处置说明",
            "FTELNO": "一楼",
            "FUSEDATE": "2024-12-01",
            "FBEGTIME":"2024-09-14",
            "FENDTIME":"2024-09-14",
            "FMEMO": "",
            "FCHECKUSE": "",
            "FCHECKDATE": "",
            "FNOTE":"",
            "FBILLTYPE":"访客卡",
            "FBILLSTATE": "已布防",
            "FPOINT":"上海博物馆"
            },{
            "FBILLNO": "K241130002", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME":"上海博物馆研学",
            "FHOME": "闵行春申小学",
            "FFILENAME": "关于学生走丢处理说明",
            "FTELNO": "二楼",
            "FUSEDATE": "2024-12-01",
            "FBEGTIME":"2024-09-14",
            "FENDTIME":"2024-09-14",
            "FMEMO": "",
            "FCHECKUSE": "",
            "FCHECKDATE": "",
            "FNOTE":"",
            "FBILLTYPE":"访客卡",
            "FBILLSTATE": "已布防",
            "FPOINT":"上海博物馆"
            }
        ],
        loading: false,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fuser: "",
          fcustomno: ""
        },
      };
    },
    computed: {},
    created() {
    },
    methods: {
      insert(row) {
        this.$refs.Form.init(row);
      },
      view(row) {
        //this.$refs.Form.init(row);
        let link = document.createElement('a');
        link.href = 'http://180.166.193.6:90/images/safe.pdf';
        link.target = '_blank'; // 在新窗口或新标签页中打开URL
        link.click();
      },
    },
  };
</script>